using System;
using System.Collections.Generic;
using System.Text;
using EpubLibrary;
using HtmlAgilityPack;
using System.IO;

namespace Test
{
    class Program
    {
        static void Main(string[] args)
        {
            //googleViewLib.GoogleAPI.test();

            string url = "http://www.webtretho.com/home/news/view/20782/2011/10/su-that-ve-dau-nanh-doi-voi-suc-khoe-me-va-be.htm" ;
            url = "http://www.webtretho.com/forum/f2740/me-va-wtt-1094992/";
            url = "http://www.webtretho.com/forum/f2740/me-va-wtt-1094992/";
            Readability ability = new Readability(false, true, true, EpubLibrary.ReadingStyle.Newspaper, EpubLibrary.ReadingMargin.Medium, EpubLibrary.ReadingSize.Medium);
            //HtmlDocument doc = EpubLibrary.Content.LoadContent(.LoadContent(url);
            HtmlAgilityPack.HtmlDocument doc = new HtmlAgilityPack.HtmlDocument();
            
            StreamReader reader = new StreamReader("G:\\website\\googleView\\test.html");           
            doc.LoadHtml(reader.ReadToEnd());
            reader.Close();

            doc.OptionFixNestedTags = true;
            doc.OptionAutoCloseOnEnd = true;
            doc.OptionExtractErrorSourceText = true;
            doc.OptionDefaultStreamEncoding = Encoding.Unicode;
            doc.OptionWriteEmptyNodes = true;

            ability.document = doc;
            ability.removeScripts();
            ability.parsedPages[ability.removeLastSlash(url)] = true;

            doc = ability.prepDocument(doc);
            
            ability.removeScripts();
            HtmlNode node = ability.grabArticle(null);
            HtmlNodeCollection colections = node.SelectNodes(".//text()");
            string comment = ability.getComment(ability.topCandidate);
            System.Console.Write(node.InnerHtml);
        }
    }
}
